/**
 * App Component定义
 */
import React, { Component } from 'react';
import { BrowserRouter as Router, Route, Switch } from 'react-router-dom';
// 负责授权验证的router组件
import EnsureLoggedInContainer from './components/utils/EnsureLoggedInContainer';
// 顶端和底部组件
import TopMenu from './components/menu/TopMenu';
import Footer from './components/footer/Footer';
// 默认界面组件
import MainPanel from './components/MainPanel';
// Auth部分组件
import LoginPanel from './components/auth/LoginPanel';
import RegisterPanel from './components/auth/RegisterPanel';
import ResetPwdPanel from './components/auth/ResetPwdPanel';
import ProfilePanel from './components/auth/ProfilePanel';
// 业务部分组件
import UserPanel from './components/dataviz/usertable/UserPanel';
import UserEditPanel from './components/dataviz/usertable/UserEditPanel';
import MapAddCityPanel from './components/dataviz/map/MapAddCityPanel';
// 图表组件
import ChartPanel from './components/dataviz/chart/ChartPanel';
// 地图相关组件
import MapScenePanel from './components/dataviz/map/MapScenePanel';
import MapEditPanel from './components/dataviz/map/MapEditPanel';
import Map2DPanel from './components/dataviz/map/Map2DPanel';
import MapGeojsonPanel from './components/dataviz/map/MapGeojsonPanel';

class App extends Component {
    render() {
        return (
            <Router>
                <div className="App">
                    <TopMenu></TopMenu>
                    <Route exact path="/" component={MainPanel}></Route>
                    <Route exact path="/register" component={RegisterPanel}></Route>
                    <Route exact path="/login" component={LoginPanel}></Route>
                    <Switch>
                        <EnsureLoggedInContainer path="/resetpassword" component={ResetPwdPanel}></EnsureLoggedInContainer>
                        <EnsureLoggedInContainer path="/userpanel" component={UserPanel}></EnsureLoggedInContainer>
                        <EnsureLoggedInContainer path="/useredit/:id" component={UserEditPanel}></EnsureLoggedInContainer>
                        <EnsureLoggedInContainer path="/profile" component={ProfilePanel}></EnsureLoggedInContainer>
                        <EnsureLoggedInContainer path="/charts" component={ChartPanel}></EnsureLoggedInContainer>
                        <EnsureLoggedInContainer path="/addcity" component={MapAddCityPanel}></EnsureLoggedInContainer>
                        <EnsureLoggedInContainer path="/globescene" component={MapScenePanel}></EnsureLoggedInContainer>
                        <EnsureLoggedInContainer path="/2dleafletmaps" component={MapEditPanel}></EnsureLoggedInContainer>
                        <EnsureLoggedInContainer path="/2desrimaps" component={Map2DPanel}></EnsureLoggedInContainer>
                        <EnsureLoggedInContainer path="/mapgeojson" component={MapGeojsonPanel}></EnsureLoggedInContainer>
                    </Switch>
                    <Footer></Footer>
                </div>    
            </Router>
        );
    }
}
export default App;
